import request from '@/utils/request'

// 获取排班列表（分页）
export function getSchedulePage(params) {
  return request({
    url: '/scheduling/monthly-page',
    method: 'get',
    params
  })
}

// 导入排班
export function importSchedule(file, importMonth) {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('importMonth', importMonth)
  
  return request({
    url: '/scheduling/import-scheduling',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 导出排班表
export function exportSchedule(params) {
  console.log('API调用导出排班表参数:', params)
  return request({
    url: '/scheduling/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 批量删除排班数据
export function deleteScheduleByEmployees(employeeNumbers, month) {
  return request({
    url: '/scheduling/delete-by-employees-and-month',
    method: 'delete',
    data: employeeNumbers,
    params: { month }
  })
}